<?php
/**
 * Created by PhpStorm.
 * User: hooshim
 * Date: 2014-12-03
 * Time: 오전 11:23
 */

header("Content-Type:text/html;charset=utf-8");
header("Cache-Control:no-cache");
header("Pragma:no-cache");

include_once ($_SERVER['DOCUMENT_ROOT']."/inc/conn.inc.php");
include_once ($_SERVER['DOCUMENT_ROOT']."/inc/function.inc.php"); ##property 파일 인크루드됨.

	//## 파라미터 선언
    $compCd 			= $_POST['compCd'];

	// Table 이름 선언
	$tbname = "tblCompany";

    $curDt =date("Y-m-d");

    $query = "SELECT compCd, compNo, companyKR, addrKR, compType, compPart, owner, companyEN, phone, fax, major, cellphone, majorPhone, addrEN, email, memo, flag ";
    $query .= " FROM {$tbname} WHERE compCd={$compCd}";
    $query = iconvEncode($query);

    $logger->debug($query ."<br>[#FROM:" . $G_remote_ip."#]"); ## 쿼리 로그 작성
    $result = makeJSONArray($query,$tbname);
    $oilRate = aFieldValue("SELECT rate FROM tblRateExpressConfig WHERE compCd={$compCd} AND expressCd='OIL'");
    $result["OIL"] = $oilRate;
    $emsRate = aFieldValue("SELECT rate FROM tblRateExpressConfig WHERE compCd={$compCd} AND expressCd='EMS'");
    $result["EMS"] = $emsRate;
    $dhlRate = aFieldValue("SELECT rate FROM tblRateExpressConfig WHERE compCd={$compCd} AND expressCd='DHL'");
    $result["DHL"] = $dhlRate;
    $upsRate = aFieldValue("SELECT rate FROM tblRateExpressConfig WHERE compCd={$compCd} AND expressCd='UPS'");
    $result["UPS"] = $upsRate;
    $tntRate = aFieldValue("SELECT rate FROM tblRateExpressConfig WHERE compCd={$compCd} AND expressCd='TNT'");
    $result["TNT"] = $tntRate;

    $output = json_encode($result);
    $output = urldecode($output);
    $output = iconvDecode($output);
    $output = str_replace("<br />", "", $output);
    echo $output;
    $logger->debug($compCd ."//" .$output ."<br>[#FROM:" . $G_remote_ip."#]"); ## 결과 로그 작성
?>